
const _CONST = {
    MENU: 'os-menu'
}

const state = {
    sidebar: {
        menu: window.sessionStorage.getItem(_CONST.MENU) || []
    }
}

const mutations = {
    SET_MENU: (state, value) => {
        let list = {
            title: '首页',
            icon: '',
            path: '/index'
        }
        state.sidebar.list = value.push(list)
        window.sessionStorage.setItem(_CONST.MENU, value)
    }
}

const actions = {
    set_menu({commit}, {list}){
        commit('SET_MENU', list)
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}